#ifndef DBMANAGER_H
#define DBMANAGER_H

#include <QObject>
#include <QMessageBox>
#include <QSqlDatabase>
#include <QSqlQuery>
#include "db_query.h"
class DBManager : public QObject
{
    Q_OBJECT
public:

    static DBManager * getInstance(){
        return dbManager_;
    }
    /**
     * @brief 初始化数据库
     */
    bool init();

    QList<DeptNode> selectDeptQuery(QString sql);
    //QList<UserInfo> selectUserQuery(QString sql);
    QMap<QString,QString> selectLoginQuery(QString sql);
    QList<QList<QString>> select(QString sql);
    QSqlDatabase getDataDBClient();
signals:

public slots:

private:
    DBManager(QObject *parent = nullptr);
private:
    static DBManager *dbManager_;
    QString ip_;
    QString port_;
    QString user_;
    QString pwd_;
    DBQuery *dbQuery;
};

#endif // DBMANAGER_H
